package stack_queue_1018;

import java.util.Stack;

public class StackDemo {
    public static void main(String[] args) {
        Stack<String> stack = new Stack<>();

        stack.push("甲");
        stack.push("乙");
        stack.push("丙");
        stack.push("丁");

        // stack.isEmpty() 完全等价于 stack.empty()
        while (!stack.isEmpty()) {
            String p = stack.peek();
            String e = stack.pop();
            System.out.println(e);
        }
    }
}
